/**
 * 
 */
package com.sophossystems.client.asmon.action;


import org.apache.log4j.Logger;
import org.apache.struts2.StrutsTestCase;
import com.opensymphony.xwork2.ActionProxy;
import static org.junit.Assert.*;
import org.junit.Test;
/**
 * @author juanvelezballesteros
 *
 */
public class LoginActionTestCase extends StrutsTestCase {

	
	private static Logger log = Logger.getLogger(LoginActionTestCase.class);
	/**
	 * Test method for {@link com.sophossystems.client.asmon.action.LoginAction#execute()}.
	 */
	@Test
	public void testExecute() throws Exception {
		request.setParameter("user.userName", "juanvelez");
    	request.setParameter("user.password", "tvbl6u1m");
    	ActionProxy proxy = getActionProxy("doLogin");
    	LoginAction accountAction = (LoginAction) proxy.getAction();
    	  proxy.execute();
    	  assertTrue("Problem There were no errors present in fieldErrors but there should have been one error present", accountAction.getFieldErrors().size() == 1);
  		assertTrue("Problem field account.userName not present in fieldErrors but it should have been",
  				accountAction.getFieldErrors().containsKey("accountBean.userName") );

	}

	/**
	 * Test method for {@link com.sophossystems.client.asmon.action.LoginAction#logout()}.
	 */
	@Test
	public void testLogout() {
		fail("Not yet implemented");
	}

}
